/************************************  

DESCRIPTION: This is just a check on the outcome means.

************************************/  

set more off
capture log close
clear all

set matsize 10000

global origData "N:\MedicareClaims-P045601-BE"
global dataIn "N:\MedicareClaims-P045601-BE\Work\hosp_retro\health_out\Data-In\"
global dataOut "N:\MedicareClaims-P045601-BE\Work\hosp_retro\health_out\Data-Out"
global dpath "N:\MedicareClaims-P045601-BE\Work\ay_data"
global dataProp "N:\MedicareClaims-P045601-BE\Work\hosp_retro\health_out\Data-Out\PropScore\Patients"
global logs "N:\MedicareClaims-P045601-BE\Work\hosp_retro\health_out\Logs\PropScore\Patients"
global dpath "N:\MedicareClaims-P045601-BE\Work\ay_data"
global skapath "N:\MedicareClaims-P045601-BE\Work\ska"
global output

adopath +  "N:/SIL-Common/estout"
adopath +  "N:/SIL-Common/outreg2"
adopath +  "N:/SIL-Common/reghdfe-master/package"

log using "./4LPMmeans.log", replace

*MEN
use mx* oc* kv* using ./maleLPManalysis.dta
 *Men Diabetes
 foreach var of varlist oc_death oc_diabcomp1 oc_diabcomp2 oc_glaucoma {
 if regexm("`var'","oc_([a-z0-9]+)$") { 
  local pre = "`=regexs(1)'"
 }
 
 di "Male " "`pre'"
 
 summ `var' if  kv_`pre'==1 & mxdiabetes==1
 
}

 *Men hypertension
 foreach var of varlist oc_death oc_acute oc_ihd oc_ami {
 if regexm("`var'","oc_([a-z0-9]+)$") { 
  local pre = "`=regexs(1)'"
 }
 
 di "Male " "`pre'"
 
 summ `var' if  kv_`pre'==1 & mxhypertension==1
 
}

use mx* oc* kv* using ./maleLPManalysis.dta

 *Men Death
 foreach var of varlist oc_death {
 if regexm("`var'","oc_([a-z0-9]+)$") { 
  local pre = "`=regexs(1)'"
 }
 
 di "Male " "`pre'"
 
 summ `var' if  kv_`pre'==1  
 
}


*WOMEN
use mx* oc* kv* using ./femLPManalysis.dta
 *Women Diabetes
 foreach var of varlist oc_death oc_diabcomp1 oc_diabcomp2 oc_glaucoma {
 if regexm("`var'","oc_([a-z0-9]+)$") { 
  local pre = "`=regexs(1)'"
 }
 
 di "Female " "`pre'"
 
 summ `var' if  kv_`pre'==1 & mxdiabetes==1
 
}

 *women hypertension
 foreach var of varlist oc_death oc_acute oc_ihd oc_ami {
 if regexm("`var'","oc_([a-z0-9]+)$") { 
  local pre = "`=regexs(1)'"
 }
 
 di "Female " "`pre'"
 
 summ `var' if  kv_`pre'==1 & mxhypertension==1
 
}

use mx* oc* kv* using ./femLPManalysis.dta

 *women Death
 foreach var of varlist oc_death {
 if regexm("`var'","oc_([a-z0-9]+)$") { 
  local pre = "`=regexs(1)'"
 }
 
 di "Female " "`pre'"
 
 summ `var' if  kv_`pre'==1  
 
}
